<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.css">
</head>
<body>
    <form id="book-form">
        <div class="form-group">
            <label for="bookName">图书名字:</label>
            <input type="text" class="form-control" id="bookName" name="bookName">
        </div>

        <div class="form-group">
            <label for="bookPrice">图书价格：</label>
            <input type="number" class="form-control" step="0.01" id="bookPrice" name="bookPrice">
        </div>

        <div class="form-group">
            <label for="bookDate">图书日期：</label>
            <input type="date" class="form-control" id="bookDate" name="bookDate">
        </div>

        <div class="form-group">
            是否上架：
            <label class="radio-inline">
                <input type="radio" name="bookPutaway" id="optionsRadios3" value="是" checked> 是
            </label>
            <label class="radio-inline">
                <input type="radio" name="bookPutaway" id="optionsRadios4"  value="否"> 否
            </label>
        </div>


        <div class="form-group">
            <label for="bookType">图书类型：</label>
            <select class="form-control" name="bookType" id="bookType">
                <option value="">请选择</option>
                <option value="穿越">穿越</option>
                <option value="穿越">玄幻</option>
                <option value="穿越">修真</option>
                <option value="扫黄书">扫黄书</option>
                <option value="有色书籍">有色书籍</option>
            </select>
        </div>

        <div class="form-group">
            <label for="bookAuthor">图书作者：</label>
            <input type="text" class="form-control" id="bookAuthor" name="bookAuthor">
        </div>
        <button type="button" id="sub-btn" class="btn btn-primary">提交</button>
        <button type="reset" class="btn btn-primary">重置</button>
    </form>
<!--引入js-->
<script type="text/javascript" src="../css/jquery-3.4.1.js"></script>
<script src="../bootstrap-4.6.0-dist/js/bootstrap.js" ></script>
<script src="../vue/vue.js" charset="utf-8"></script>
<script>
    //提交表单
    $("#sub-btn").click(function () {
        $.ajax({
            type:"post",
            url:"../Book/addBook",
            data:$("#book-form").serialize(),
            dataType:"json",
            success:function (json) {
                alert(json.msg);
            }
        })
    })
</script>
</body>
</html>